﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace TraCuuDiemNhom3.DaoTao
{
    public partial class XoaDiemSV : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        DataTable tblXoa;
        protected void btnDelete_Click(object sender, EventArgs e)
        {           
            int a = TienIchSQL.ChayLenhUpdateDuLieu("Delete Diem where MaSV = @maSV", "@maSV", txtMaSV.Text);
            if (a > 0)
            {
                lblStatus.Visible = true;
                lblStatus.Text = "Đã xóa thành công " + a.ToString() + " dòng dữ liệu!!!";
            }
        }

        protected void btnView_Click(object sender, EventArgs e)
        {
            tblXoa = TienIchSQL.ChayLenhSelectDuLieu("Select n.HoTen, substring(MaSV,5,2) as MaLop, MaMH , HocKy from Diem d, nguoidung n where n.UserName= d.MaSV and d.maSV= @maSV ", "@maSV", txtMaSV.Text);
            lblHocKy.Text = tblXoa.Rows[0]["HocKy"].ToString();
            lblHoTen.Text = tblXoa.Rows[0]["HoTen"].ToString();
            lblMaLop.Text = tblXoa.Rows[0]["MaLop"].ToString();
            lblMonHoc.Text = tblXoa.Rows[0]["MaMH"].ToString();

        }

        protected void txtMaSV_TextChanged(object sender, EventArgs e)
        {

        }
    }
}